package com.ykdl.member.kid.marketcard;

import android.os.Bundle;
import android.webkit.WebView;

import com.ykdl.member.constant.KidAction;
import com.ykdl.member.constant.KidConfig;
import com.ykdl.member.kid.gears.WebViewActivity;
import com.ykdl.member.kid.util.AccessTokenKeeper;

public class CouponinfoWebView  extends WebViewActivity{
	private static AccessTokenKeeper mTokenKeeper;
	private String coupon_id="" ;
	private int URL_TYPE ;
	private String product_id ="" ;
	private String order_id ="" ;
	private String random_lottery_prize="";
	private String lottery_id ="" ;
	private String store_id ="" ;
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		goneButton();
	}
	@Override
	protected void getIntentData() {
		// TODO Auto-generated method stub
		URL_TYPE = this.getIntent().getIntExtra(KidAction.URL_TYPE, 9999);
		coupon_id = this.getIntent().getStringExtra(KidAction.COUPON_ID);
		order_id = this.getIntent().getStringExtra(KidAction.ORDER_ID);
		product_id = this.getIntent().getStringExtra(KidAction.PRODUCT_ID);
		random_lottery_prize = this.getIntent().getStringExtra(KidAction.RANDOM_LOTTERY_PRIZE);
		lottery_id = this.getIntent().getStringExtra(KidAction.LOTTERY_ID);
		store_id = this.getIntent().getStringExtra(KidAction.STORE_ID);
	}

	@Override
	protected void setWapTitle() {
		// TODO Auto-generated method stub
		if (URL_TYPE==0) {
			noShowTitle();
			 tv_title.setText("优惠券详情");
		}
	}

	@Override
	protected void startLoadUrl() {
		// TODO Auto-generated method stub
		mTokenKeeper = new AccessTokenKeeper(this);
		String url = "";
		switch (URL_TYPE) {
		case 0://优惠卷详情
			url = KidConfig.TICKET_INFO + coupon_id + "?"
					+ mTokenKeeper.getmAccessTokenTitle() + "="
					+ mTokenKeeper.getmAccessToken();
			break;
		case 1://商品详情
			url = KidConfig.PRODUCT_LIST_H5 +store_id+"/product/"+ product_id+".html" + "?"+ mTokenKeeper.getmAccessTokenTitle() + "="
					+ mTokenKeeper.getmAccessToken();
			break;
		case 2://订单详情
			url = KidConfig.ORDER_SHOW +"?order_id="+ order_id + "&"
					+ mTokenKeeper.getmAccessTokenTitle() + "="
					+ mTokenKeeper.getmAccessToken();
			break;
		case 3://门店优惠卷详情
			url = KidConfig.COUPON_INFO + coupon_id + "?"
					+ mTokenKeeper.getmAccessTokenTitle() + "="
					+ mTokenKeeper.getmAccessToken();
			break;
		case 4://玩转积分
			url = KidConfig.BASE_CARD_SERVER + random_lottery_prize + "?"
					+ mTokenKeeper.getmAccessTokenTitle() + "="
					+ mTokenKeeper.getmAccessToken();
			break;
		case 5://刮刮奖
			url = KidConfig.LOTTERY_SCRATCH + lottery_id + "?"
					+ mTokenKeeper.getmAccessTokenTitle() + "="
					+ mTokenKeeper.getmAccessToken();
			break;
		case 6://大转盘
			url = KidConfig.LOTTERY_WHEEL + lottery_id + "?"
					+ mTokenKeeper.getmAccessTokenTitle() + "="
					+ mTokenKeeper.getmAccessToken();
			break;
		case 7://我的在线优惠券详情--我的优惠券
			url = KidConfig.MY_TICKET_INFO + coupon_id + "?"
					+ mTokenKeeper.getmAccessTokenTitle() + "="
					+ mTokenKeeper.getmAccessToken();
			break;
		case 8://查看在线优惠券详情--门店
			url = KidConfig.ON_LINE_COUPON_INFO + coupon_id + "?"
					+ mTokenKeeper.getmAccessTokenTitle() + "="
					+ mTokenKeeper.getmAccessToken();
			break;
		case 9://查看物流
			url = KidConfig.ORDER_LOGISTICS+"?order_id="+ order_id + "&"
					+ mTokenKeeper.getmAccessTokenTitle() + "="
					+ mTokenKeeper.getmAccessToken();
			break;
		case 10://查看物流
			url = KidConfig.ORDER_HELP+"?"
					+ mTokenKeeper.getmAccessTokenTitle() + "="
					+ mTokenKeeper.getmAccessToken();
			break;
				
		
		default:
			break;
		}
		
		webView.loadUrl(url);
	}

	@Override
	protected boolean overrideUrlLoading(WebView view, String url) {
		// TODO Auto-generated method stub
		return false;
	}
	
}
